var app = angular.module('ZJPC');
app.controller('BasicPerFileCtrl', ['$scope','$state','$rootScope','$stateParams','DataService',BasicPerFileCtrl]);

function BasicPerFileCtrl($scope,$state,$rootScope,$stateParams,DataService) {
	if($stateParams.data.indexOf('{')==0){
		callback(angular.fromJson($stateParams.data))
/*		$stateParams.xm = angular.fromJson($stateParams.xm).xm;*/
	}else{
		$scope.loading = true;
		DataService.getPerson($stateParams.jid,callback)
	}

	function callback(data){
		$scope.loading = false;
		$scope.perFile = data;
		console.log(data);
		if($scope.perFile.rylx=='教师'){
				$scope.loading = true;
			DataService.getTeacherCar($stateParams.jid,function(data){
				$scope.loading = false;
				if(data!=null&&data.length!=0){
					if(data.cph==undefined){
						//多个
						$scope.perFile['yktCarinfo'] = data;	
					}else{
						$scope.perFile['yktCarinfo'] = [data];	
					}
				}
			})
		}
		
	}

}